﻿<!--#include file="base.asp"-->
<%
''' SDCMS 心情
''' ==================================================================
''' 版权所有 http://www.sdcms.cn
''' ------------------------------------------------------------------
''' 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用；
''' 未经授权不允许对程序代码以任何形式任何目的的再发布。
''' ==================================================================
''' 编写: IT平民
''' 修改：IT平民 in 2014.07

	sub configdb()
		dim t0,t1
		t0=sdcms.enhtml(sdcms.fpost("t0",0))
		sdcms.db.dbupdate "sd_config","setname='sdcms.expand' and setkey='expand.mood'",array(array("setvalue",t0,0,1))
		sdcms.delcache "sdcmsdata"
		sdcms.ajaxjson "保存成功",1
	end sub
	
	function get_mood(byval t0)
		select case t0
			case "1":get_mood="高兴"
			case "2":get_mood="感动"
			case "3":get_mood="同情"
			case "4":get_mood="愤怒"
			case "5":get_mood="搞笑"
			case "6":get_mood="难过"
			case "7":get_mood="新奇"
			case "8":get_mood="无聊"
		end select
	end function
	
	sub editdb()
		dim t0,t1
		t0=sdcms.getint(sdcms.fpost("t0",0),0)
		t1=sdcms.getint(sdcms.fpost("t1",0),0)
		dim data,id
		id=sdcms.getint(sdcms.fget("id",0),0)
		data=array(array("moodtype",t0,0,0),array("moodnum",t1,10,0))
		if sdcms.db.dbupdate("sd_expand_mood","moodid="&id&"",data)=1 then
			sdcms.ajaxjson "保存成功",1
		end if
	end sub
	
	sub deldb()
		dim id:id=sdcms.getint(sdcms.fget("id",0),0)
		sdcms.db.dbdel "sd_expand_mood","moodid="&id
		sdcms.echo "1"
	end sub
	
	sub delsome()
		dim id:id=sdcms.enhtml(sdcms.fget("id",0))
		dim idarr:idarr=split(id,",")
		if ubound(idarr)<0 then
			sdcms.echo "0&#33267;&#23569;&#36873;&#25321;&#19968;&#26465;&#20449;&#24687;"
		else
			dim i
			for i=0 to ubound(idarr)
				if not isnumeric(idarr(i)) then
					sdcms.echo "0&#21442;&#25968;&#65306;"&id(i)&"&#19981;&#27491;&#30830;&#65292;&#35831;&#30830;&#35748;&#21518;&#20877;&#25805;&#20316;"
					exit sub
				else
					sdcms.db.dbdel "sd_expand_mood","moodid="&idarr(i)
				end if
			next
			sdcms.echo "1"
		end if
	end sub
	
	islogin
	checkpagelever 36
	dim act:act=lcase(sdcms.fget("act",0))
	dim sqlwhere,nattitle,nat
	nat=sdcms.getint(sdcms.fget("nat",0),0)
	select case act
		case "config"
			dim sitedata,data
			sitedata=sdcms.db.dbload(1,"setvalue","sd_config","setname='sdcms.expand' and setkey='expand.mood'","")
			data=sitedata(0,0)
			load eval("theme_expand_mood_"&act)
		case "configdb":configdb
		case "edit"
			dim datadb,id
			id=sdcms.getint(sdcms.fget("id",0),0)
			datadb=sdcms.db.dbload("","moodtype,moodnum","sd_expand_mood","moodid="&id&"","")
			load eval("theme_expand_mood_"&act)
		case "editdb":editdb
		case "del":deldb
		case "delsome":delsome
		case else
			select case nat
				case "1":sqlwhere=" and moodtype=1":nattitle="性质:高兴"
				case "2":sqlwhere=" and moodtype=2":nattitle="性质:感动"
				case "3":sqlwhere=" and moodtype=3":nattitle="性质:同情"
				case "4":sqlwhere=" and moodtype=4":nattitle="性质:愤怒"
				case "5":sqlwhere=" and moodtype=5":nattitle="性质:搞笑"
				case "6":sqlwhere=" and moodtype=6":nattitle="性质:难过"
				case "7":sqlwhere=" and moodtype=7":nattitle="性质:新奇"
				case "8":sqlwhere=" and moodtype=8":nattitle="性质:无聊"
				case else:nattitle="按性质↓"
			end select
			load theme_expand_mood
	end select
	sdcms.db.dbclose
%>